/**
 * This class represents a client session and stores the server, user and client settings for a
 * particular client session.
 */
package org.hackystat.ui.projectviewer.gwt.client.common;

import java.util.ArrayList;

/**
 * Provides the storage for session specific variables.
 * 
 * @author David J. Nickles, Pavel Senin.
 * 
 */
public class Session {

  /** This is singleton. */
  private static Session instance;

  /** The user credentials. */
  private String user;
  private String password;

  /** The list of user projects. */
  private ArrayList<String> projects;

  /** The sensorbase host. */
  private String sensorbaseHost;
  /** The dailyprojectdata host. */
  private String dpdHost;
  /** The telemetry host. */
  private String telemetryHost;

  /**
   * Reports Session instance.
   * 
   * @return Session instance.
   */
  public static Session getInstance() {
    if (null == instance) {
      instance = new Session();
    }
    return instance;
  }

  /**
   * Sets the user name.
   * 
   * @param user The user name to set.
   */
  public void setUser(String user) {
    this.user = user;
  }

  /**
   * Reports user name.
   * 
   * @return The user name.
   */
  public String getUser() {
    return this.user;
  }

  /**
   * Sets the user password.
   * 
   * @param password The password to set.
   */
  public void setPassword(String password) {
    this.password = password;
  }

  /**
   * Reports user password.
   * 
   * @return The password
   */
  public String getPassword() {
    return this.password;
  }

  /**
   * Sets the sensorbase host.
   * 
   * @param sensorbaseHost The sensorbaseHost to set.
   */
  public void setSensorbaseHost(String sensorbaseHost) {
    this.sensorbaseHost = sensorbaseHost;
  }

  /**
   * Reports sensorbase host.
   * 
   * @return The sensorbase host URI.
   */
  public String getSensorbaseHost() {
    return this.sensorbaseHost;
  }

  /**
   * Sets the DPD host.
   * 
   * @param dpdHost The DPD host to set.
   */
  public void setDPDHost(String dpdHost) {
    this.dpdHost = dpdHost;
  }

  /**
   * Reports the dailyprojectdata host.
   * 
   * @return The DPD host.
   */
  public String getDPDHost() {
    return this.dpdHost;
  }

  /**
   * Sets the Telemetry host.
   * 
   * @param telemetryHost The Telemetry host to set.
   */
  public void setTelemetryHost(String telemetryHost) {
    this.telemetryHost = telemetryHost;
  }

  /**
   * Reports the telemetry host.
   * 
   * @return The DPD host.
   */
  public String getTelemetryHost() {
    return this.telemetryHost;
  }

  /**
   * Set the list of projects.
   * 
   * @param projects The list of the projects.
   */
  public void setProjectIdx(ArrayList<String> projects) {
    this.projects = projects;
  }

  /**
   * Reports a list of user projects.
   * 
   * @return The composite list of the projects.
   * 
   */
  public ArrayList<String> getProjectIndex() {
    return this.projects;
  }

}
